package structuralpattern.component;
/**
 * 菜单项
 * 不能再有子菜单，所以添加菜单，移除菜单和获取子菜单的功能并不能实现。
 * */
public class MenuItem extends MenuComponent{

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.println("---");
        }
        System.out.println(name);
    }
}
